<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">

    <style>
        .box{
            border: solid 1px #C9C9C9;
            margin: 10px;
        }
        .word-card{
            display: flex;
            flex-direction: row;
            flex-wrap: wrap;
            justify-content: center;
            align-items: center;

        }
        .word{
            margin:10px !important;
            border: 1px solid #C9C9C9;
            background-color: #fff;
            font-size: 24px;
            color: #383838;text-decoration: none;cursor: pointer;
            padding-left: 3px;
            padding-right: 3px;
        }
    </style>
</head>

<body>
        <div id="demo_x" class="box" ></div>
        <div style="margin: 10px;color: #5a5a5a;font-size: 15px;">
            词云列表demo，会自动换行，当一行显示不完全
        </div>
</body>

<!-- 必要 -->
<script src="https://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
<script src="./render_somthing.js"></script>
<link href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/5.0.0-alpha1/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.staticfile.org/popper.js/1.15.0/umd/popper.min.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/5.0.0-alpha1/js/bootstrap.min.js"></script>
<script>
    {
        var render_somthing_demo_x;
        render_somthing_demo_x = new render_somthing();
        render_somthing_demo_x.init({
            // div的id
            id: "#demo_x",
            // x/y/flow   分别为x向滚动、y向滚动、瀑布流
            method: "x",
            // 容器是指即将渲染内容的外围容器，可以为div/table/ul ...
            container: {
                html: `
                <div class="word-card"></div>
    `
            },
            // 渲染内容的配置
            content: {
                default: `
                <a class="word" style="color:#{color}">#{word}</a>
`,
            },
            // 条件渲染内容
            /*
                ^{ROW_INDEX} - 常量，表示数据数组的下标
                #{title}     - 变量，表示数据数组中对象的key
            */
            condition: [
            ],
        })
        render_somthing_demo_x.render([{
                        word:"儿童图书",
                        color:"rgb(10, 88, 74)",
                    }, {
                        word:"励志",
                        color:"rgb(251, 43, 53)",
                    }, {
                        word:"人文社科",
                        color:"rgb(117, 133, 14)",
                    }, {
                        word:"科技",
                        color:"rgb(73, 5, 91)",
                    }, {
                        word:"儿童图书",
                        color:"rgb(51, 25, 53)",
                    }, {
                        word:"人文社科",
                        color:"rgb(117, 133, 14)",
                    }, {
                        word:"科技",
                        color:"rgb(73, 5, 91)",
                    }, {
                        word:"生活",
                        color:"rgb(33, 80, 65)",
                    }, {
                        word:"人文社科",
                        color:"rgb(117, 133, 14)",
                    }, {
                        word:"科技",
                        color:"rgb(73, 5, 91)",
                    }, {
                        word:"励志",
                        color:"rgb(251, 43, 53)",
                    }, ]);
    }
</script>

</html>